package com.wzk.service.impl;

import com.wzk.mapper.EmpMapper;
import com.wzk.mapper.StudentMapper;
import com.wzk.pojo.ClazzSizeOption;
import com.wzk.pojo.JobOption;
import com.wzk.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class ReportServiceImpl implements ReportService {
    @Autowired
    private EmpMapper empMapper;
    @Autowired
    private StudentMapper studentMapper;
    @Override
    public JobOption getEmpJobData() {
        List<Map<String, Object>> reportlist = empMapper.getReportlist();
        List<Object> jobList = reportlist.stream().map(dateMap -> dateMap.get("pos")).toList();
        List<Object> numList = reportlist.stream().map(dateMap -> dateMap.get("num")).toList();
        return new JobOption(jobList,numList);
    }

    @Override
    public List<Map<String,Object>> getEmpGenderData() {
        return empMapper.getGender();
    }

    @Override
    public List<Map<String, Object>> getStudentDegreeData() {
        return studentMapper.getStudentDegreeData();
    }

    @Override
    public ClazzSizeOption getClazzData() {
        List<Map<String, Object>> clazzList = studentMapper.getClazzData();
        List<Object> clazz = clazzList.stream().map(dateMap -> dateMap.get("clazz")).toList();
        List<Object> numList = clazzList.stream().map(dateMap -> dateMap.get("num")).toList();
        return new ClazzSizeOption(clazz,numList);
    }
}
